/* GUI CONVERTED from rcrsupa.p (converter v1.76) Fri May  3 13:22:02 2002 */
/* rcrsupa.p - Release Management Customer Schedules                    */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                  */
/* All rights reserved worldwide.  This is an unpublished work.         */
/* $Revision: 1.23 $                                                     */
/*V8:ConvertMode=Report                                                 */
/* REVISION: 7.0    LAST MODIFIED: 01/29/92           BY: WUG *F110*    */
/* REVISION: 7.0    LAST MODIFIED: 03/16/92           BY: WUG *F312*    */
/* REVISION: 7.0    LAST MODIFIED: 03/26/92           BY: WUG *F323*    */
/* REVISION: 7.0    LAST MODIFIED: 06/12/92           BY: WUG *F606*    */
/* REVISION: 7.3    LAST MODIFIED: 10/06/92           BY: WUG *G462*    */
/* REVISION: 7.3    LAST MODIFIED: 08/13/93           BY: WUG *GE19*    */
/* REVISION: 7.3    LAST MODIFIED: 08/29/95           BY: bcm *G0TB*    */
/* REVISION: 7.3    LAST MODIFIED: 07/22/96           BY: *G29C* Ajit Deodhar */
/* REVISION: 8.5    LAST MODIFIED: 06/11/97           BY: *J1SX* Aruna Patil  */
/* REVISION: 8.5    LAST MODIFIED: 10/07/97           BY: *G2PR* Manish K.    */
/* REVISION: 8.6E   LAST MODIFIED: 02/23/98           BY: *L007* A. Rahane    */
/* REVISION: 8.6E   LAST MODIFIED: 04/15/98           BY: *J2GD* Samir Bavkar */
/* REVISION: 8.6E   LAST MODIFIED: 04/21/98           BY: *J2JY* Niranjan R.  */
/* REVISION: 8.6E   LAST MODIFIED: 05/20/98           BY: *K1Q4* Alfred Tan   */
/* REVISION: 8.6E   LAST MODIFIED: 10/04/98           BY: *J314* Alfred Tan   */
/* REVISION: 9.0    LAST MODIFIED: 02/06/99           BY: *M06R* Doug Norton  */
/* REVISION: 9.0    LAST MODIFIED: 03/13/99           BY: *M0BD* Alfred Tan   */
/* REVISION: 9.1    LAST MODIFIED: 09/10/99           BY: *N01B* Mugdha Tambe */
/* REVISION: 9.1    LAST MODIFIED: 05/20/99           BY: *N004* Patrick Rowan*/
/* REVISION: 9.1    LAST MODIFIED: 03/24/00       BY: *N08T* Annasaheb Rahane */
/* REVISION: 9.1    LAST MODIFIED: 04/28/00       BY: *N09M* Inna Lyubarsky   */
/* REVISION: 9.1    LAST MODIFIED: 08/12/00       BY: *N0KP* myb              */
/* REVISION: 9.1    LAST MODIFIED: 08/12/00       BY: *N0RG* Rajinder Kamra   */
/* Old ECO marker removed, but no ECO header exists *F0PN*                    */
/* $Revision: 1.23 $    BY: Katie Hilbert         DATE: 04/15/02  ECO: *P03J*  */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/

/* REQUIRED SCHEDULE UPDATE SUBPROGRAM */


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

{mfdeclre.i}
{gplabel.i} /* EXTERNAL LABEL INCLUDE */
{rcrpvar.i "shared"}
define new shared variable week_offset         as integer.
define     shared variable report_yn           like mfc_logical
                                               label "Report Detail/Summary"
                                               format "Detail/Summary".
define     shared variable update_yn           like mfc_logical no-undo.
define     shared variable audit_yn            like mfc_logical.
define     shared variable warn_ct             as integer no-undo.
define     shared variable using_seq_schedules like mfc_logical no-undo.
define            variable so_db               as character.
define            variable l_first             like mfc_logical no-undo
                                               initial true.
define            variable l_msg               as character no-undo.
define     shared stream   audit.

FORM /*GUI*/ 
with STREAM-IO /*GUI*/  frame audit down width 80 no-attr-space.

/* SET EXTERNAL LABELS */
setFrameLabels(frame audit:handle).

FORM /*GUI*/ 
   so_cust
   so_ship
   sod_part     at 20 column-label "Item Number!Customer Ref"
   sod_contr_id at 42 column-label "PO Number!Model Year"
with STREAM-IO /*GUI*/  frame e width 80 no-box no-attr-space down.

/* SET EXTERNAL LABELS */
setFrameLabels(frame e:handle).

FORM /*GUI*/ 
   so_cust
   so_ship
   sod_part     at 20
   sod_contr_id at 42
   skip
   scx_custref  at 20
   scx_modelyr  at 42
with STREAM-IO /*GUI*/  frame e2 width 80 no-box no-attr-space no-labels down.

hide stream audit all no-pause.
clear frame audit all no-pause.

for each scx_ref no-lock
   where scx_type = 1
     and scx_shipfrom >= shipfrom_from and scx_shipfrom <= shipfrom_to
     and scx_shipto >= shipto_from and scx_shipto <= shipto_to
     and scx_part >= part_from and scx_part <= part_to
     and scx_po >= po_from and scx_po <= po_to
     and scx_custref >= custref_from and scx_custref <= custref_to
     and scx_modelyr >= modelyr_from and scx_modelyr <= modelyr_to
     and scx_order >= order_from and scx_order <= order_to,
   each sod_det no-lock
      where sod_nbr = scx_order and sod_line = scx_line
        and sod_dock >= dock_from and sod_dock <= dock_to
        and (sod_curr_rlse_id[1] > "" or sod_curr_rlse_id[2] > "")
        and sod_sched_chgd,
   each so_mstr no-lock
      where so_nbr = sod_nbr
        and so_cust >= cust_from and so_cust <= cust_to,
   each ad_mstr no-lock
      where ad_addr = so_ship
      break by scx_shipfrom by so_cust by scx_shipto
            by scx_order by sod_dock by sod_part
            by sod_contr_id by scx_custref by scx_modelyr:
   /* ONLY SELECT ORDERS CREATED IN THE CURRENT DATABASE*/
   so_db = trim(substring(so_conrep,15,20)).

   if so_db <> global_db then do:
      {pxmsg.i &MSGNUM=3819 &ERRORLEVEL=2 &MSGBUFFER=l_msg
         &MSGARG1=so_db}
      put unformatted skip(2)
         l_msg
         skip
         {gplblfmt.i &FUNC=getTermLabel(""ORDER"",10) &CONCAT="': '"} +
         sod_nbr
         {gplblfmt.i &FUNC=getTermLabel(""LINE"",8) &CONCAT="': '"} +
         string(sod_line)
         skip(1).
      warn_ct = warn_ct + 1.
      next.
   end.

   /* CHECK THAT INVENTORY DATABASE IS CONNECTED */
   find si_mstr where si_site = scx_shipfrom no-lock.
   if global_db > "" and not connected (si_db) then do:
      {pxmsg.i &MSGNUM=3791 &ERRORLEVEL=2 &MSGBUFFER=l_msg &MSGARG1=si_db}
      put unformatted skip(2)
         l_msg
         skip
         {gplblfmt.i &FUNC=getTermLabel(""ORDER"",10) &CONCAT="'; '"}
         {gplblfmt.i &FUNC=getTermLabel(""LINE"",8) &CONCAT="': '"} +
         sod_nbr + "; " + string(sod_line)
         skip(1).
      warn_ct = warn_ct + 1.
      next.
   end.

   week_offset = integer(substring(so_conrep,1,1)).

   if  (page-size - line-counter < 3 ) then do:
      l_first = true.
      page.
   end.

   /* ADDED PARAMETER FOR PASSING THE SEQUENCE RLSE_ID */
   /* --- ALWAYS BLANK FOR THIS CALL ---               */
   {gprun.i ""rcrsupb.p""
      "(input sod_nbr, sod_line, sod_curr_rlse_id[1],
        sod_curr_rlse_id[2], """")"}

   if report_yn then page.
   else do:

      if  (page-size - line-counter < 3 ) then do:
         l_first = true.
         page.
      end.

      if l_first or line-counter = 1 then do:
         l_first = false.
         display
            so_cust
            so_ship
            sod_part
            sod_contr_id
         with frame e STREAM-IO /*GUI*/ .
         down 1 with frame e.
         display
            scx_custref @ sod_part
            scx_modelyr @ sod_contr_id
         with frame e STREAM-IO /*GUI*/ .
      end.

      else do:
         display
            so_cust
            so_ship
            sod_part
            sod_contr_id
            scx_custref
            scx_modelyr
         with frame e2 STREAM-IO /*GUI*/ .
         down 1 with frame e2.
      end.

      display
         getTermLabelRtColon("PLAN_RELEASE_ID",20) + " " format "x(21)"
         at 1 sod_curr_rlse_id[1]

         getTermLabelRtColon("SHIP_RELEASE_ID",20) + " " format "x(21)"
         at 1 sod_curr_rlse_id[2]
         skip(1)
      with no-box no-labels down STREAM-IO /*GUI*/ .
   end.

   pause 0 before-hide.

   if audit_yn then do:
      display stream audit
         so_cust
         so_ship
         sod_part
         sod_contr_id format "x(20)" column-label "PO Number"
      with frame audit STREAM-IO /*GUI*/ .

      down stream audit 1 with frame audit.
   end.

   pause before-hide.
end.

pause 0.
